<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Pesquisar Questionário</h2>
            <p:panel style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" />
                    <p class="subtitle">Filtros</p>
                    <h:panelGrid columns="2" style="color: #000000">
                        <p:outputLabel value="Questionário :" style="float: right; font-family: sans-serif; font-size: 12px;"  />
                        <p:inputText value="#{managerSearchQuestionnaire.questionnaire.titulo}" size="50"/>
                        <p:outputLabel value="Pergunta :" style="float: right; font-family: sans-serif; font-size: 12px;" />
                        <p:inputText value="#{managerSearchQuestionnaire.issues.title}" size="50"/>

                    </h:panelGrid>
                    <br/>
                    <center>
                        <p:commandButton value="Pesquisar" actionListener="#{managerSearchQuestionnaire.searchQuestionnaire()}" style="font-size: 12px;" icon="ui-icon-search" update="@form, table" />
                        <p:commandButton value="Cancelar" icon="ui-icon-close" actionListener="#{managerRedirect.redirect('viewQuestionnaire.xhtml')}" style="font-size: 12px;" update="@form"/>
                    </center>
                    <br/>
                    <p:dataTable id="table" value="#{managerSearchQuestionnaire.questionnaireSearch}"
                                 var="q" emptyMessage="Nenhum Questionário"
                                 styleClass="dataTable">                       
                        <f:facet name="header">
                            <h:outputText value="Questionários"/>
                        </f:facet>

                        <p:column headerText="Titulo" style="font-size: 12px; width: 400px;">
                            <h:outputText value="#{q.titulo}" style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Situação" style="font-size: 12px; width: 400px;">
                            <h:outputText value="Em Construção" style="font-size: 12px; "/>      
                        </p:column>
                        <p:column headerText="Opções" style="font-size: 12px; width: 70px;">
                            <p:commandButton icon="ui-icon-help" actionListener="#{managerEditCategory.addIssues(q)}" title="Adicionar Perguntas" />
                            <p:commandButton icon="ui-icon-circle-zoomin" actionListener="#{managerEditCategory.viewIssues(q)}" title="Visualizar Questionário" />
                            <p:commandButton icon="ui-icon-trash" title="Excluir Questionário" actionListener="#{managerCreateQuestionnaire.delete(q)}" update="@form"  />
                            <p:commandButton icon="ui-icon-flag" title="Resgatar Questionário" actionListener="#{managerCreateQuestionnaire.resgate(q)}" update="@form" rendered="#{q.states eq  false }"  />

                        </p:column>
                    </p:dataTable>
                    <br/>
                    <center>

                    </center>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>